/**
 * 
 */
package us.gaaoc.framework.webapp.backingbeans.judge;

import java.util.List;
import java.util.Map;

import javax.faces.component.UIParameter;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import us.gaaoc.framework.businessmodel.Filing;
import us.gaaoc.framework.webapp.backingbeans.BaseBackingBean;

/**
 * @author Sukhada
 * Jul 6, 2006
 * GAJE_BibbCounty_1.0
 */
@SuppressWarnings("unchecked")
public class TransmissionErrorFilingPage extends BaseBackingBean {
	
	/**
	 * Fields
	 */
	
	/** Generated Serial Version UID */
	private static final long serialVersionUID = -51532581033081621L;
	
	private DataModel errorFilingDataTable;
	private Filing filing;
	private UIParameter caseDetailsPageClicked;
	
	/**
	 * Constructor
	 *
	 */
	public TransmissionErrorFilingPage() {
		errorFilingDataTable = new ListDataModel();
		List errorFilings = this.getModelFacade().findErrorFilings();
		errorFilingDataTable.setWrappedData(errorFilings);		
	}

	/**
	 * This method navigates user to the Case Details Page.
	 * @return
	 */
	public String gotoCaseDetailPage() {
		Map sessionMap = this.getFacesContext().getExternalContext().getSessionMap();
	 	//Map requestMap = this.getFacesContext().getExternalContext().getRequestParameterMap();
	 	//String caseUuid = ((String) requestMap.get("caseUuid"));
		this.filing = (Filing)this.getCaseDetailsPageClicked().getValue();
		String caseUuid = this.filing.getUuid();
		String caseType = this.filing.getCaseType();
		String toString = "";
		
		if(caseType.equals("ChildSupportEnforcement"))
			toString = "gotoCSECaseDetailsPage";
		else
			toString = "gotoCaseDetailsPage";
	 	sessionMap.put("caseUuid", caseUuid);
	 	sessionMap.put("from", "TransmissionErrorFilingPage");			
	 	return toString;
	}

	/**
	 * This method navigates the user to the previous page.
	 * @return
	 */
	public String back(){
		return "back";
	}

	/**
	 * @return Returns the caseDetailsPageClicked.
	 */
	public UIParameter getCaseDetailsPageClicked() {
		return this.caseDetailsPageClicked;
	}

	/**
	 * @param caseDetailsPageClicked The caseDetailsPageClicked to set.
	 */
	public void setCaseDetailsPageClicked(UIParameter caseDetailsPageClicked) {
		this.caseDetailsPageClicked = caseDetailsPageClicked;
	}

	/**
	 * @return Returns the errorFilingDataTable.
	 */
	public DataModel getErrorFilingDataTable() {
		return this.errorFilingDataTable;
	}

	/**
	 * @param errorFilingDataTable The errorFilingDataTable to set.
	 */
	public void setErrorFilingDataTable(DataModel errorFilingDataTable) {
		this.errorFilingDataTable = errorFilingDataTable;
	}

	/**
	 * @return Returns the filing.
	 */
	public Filing getFiling() {
		return this.filing;
	}

	/**
	 * @param filing The filing to set.
	 */
	public void setFiling(Filing filing) {
		this.filing = filing;
	}
}
